//
// NeL - bindings
// Copyright (C) 2010 Naush
//
//This program is free software: you can redistribute it and/or modify
//it under the terms of the GNU Affero General Public License as
//published by the Free Software Foundation, either version 3 of the
//License, or (at your option) any later version.
//
//This program is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//GNU Affero General Public License for more details.
//
//You should have received a copy of the GNU Affero General Public License
//along with this program.  If not, see <http://www.gnu.org/licenses/>.
package org.ryzom.nel.misc;

public class IMouseDevice extends IInputDevice {
  private long swigCPtr;

  public IMouseDevice(long cPtr, boolean cMemoryOwn) {
    super(nelmiscJNI.IMouseDevice_SWIGUpcast(cPtr), cMemoryOwn);
    swigCPtr = cPtr;
  }

  public static long getCPtr(IMouseDevice obj) {
    return (obj == null) ? 0 : obj.swigCPtr;
  }

  protected void finalize() {
    delete();
  }

  public synchronized void delete() {
    if (swigCPtr != 0) {
      if (swigCMemOwn) {
        swigCMemOwn = false;
        nelmiscJNI.delete_IMouseDevice(swigCPtr);
      }
      swigCPtr = 0;
    }
    super.delete();
  }

  public void setMessagesMode(IMouseDevice.TMessageMode mode) {
    nelmiscJNI.IMouseDevice_setMessagesMode(swigCPtr, this, mode.swigValue());
  }

  public IMouseDevice.TMessageMode getMessagesMode() {
    return IMouseDevice.TMessageMode.swigToEnum(nelmiscJNI.IMouseDevice_getMessagesMode(swigCPtr, this));
  }

  public void setMouseMode(IMouseDevice.TAxis axis, IMouseDevice.TAxisMode axisMode) {
    nelmiscJNI.IMouseDevice_setMouseMode(swigCPtr, this, axis.swigValue(), axisMode.swigValue());
  }

  public IMouseDevice.TAxisMode getMouseMode(IMouseDevice.TAxis axis) {
    return IMouseDevice.TAxisMode.swigToEnum(nelmiscJNI.IMouseDevice_getMouseMode(swigCPtr, this, axis.swigValue()));
  }

  public void setMouseSpeed(float speed) {
    nelmiscJNI.IMouseDevice_setMouseSpeed(swigCPtr, this, speed);
  }

  public float getMouseSpeed() {
    return nelmiscJNI.IMouseDevice_getMouseSpeed(swigCPtr, this);
  }

  public void setMouseAcceleration(long speed) {
    nelmiscJNI.IMouseDevice_setMouseAcceleration(swigCPtr, this, speed);
  }

  public long getMouseAcceleration() {
    return nelmiscJNI.IMouseDevice_getMouseAcceleration(swigCPtr, this);
  }

  public void setMouseFrame(CRect rect) {
    nelmiscJNI.IMouseDevice_setMouseFrame(swigCPtr, this, CRect.getCPtr(rect), rect);
  }

  public void setFactors(float xFactor, float yFactor) {
    nelmiscJNI.IMouseDevice_setFactors(swigCPtr, this, xFactor, yFactor);
  }

  public float getXFactor() {
    return nelmiscJNI.IMouseDevice_getXFactor(swigCPtr, this);
  }

  public float getYFactor() {
    return nelmiscJNI.IMouseDevice_getYFactor(swigCPtr, this);
  }

  public CRect getMouseFrame() {
    return new CRect(nelmiscJNI.IMouseDevice_getMouseFrame(swigCPtr, this), false);
  }

  public void setDoubleClickDelay(long ms) {
    nelmiscJNI.IMouseDevice_setDoubleClickDelay(swigCPtr, this, ms);
  }

  public long getDoubleClickDelay() {
    return nelmiscJNI.IMouseDevice_getDoubleClickDelay(swigCPtr, this);
  }

  public void setMousePos(float x, float y) {
    nelmiscJNI.IMouseDevice_setMousePos(swigCPtr, this, x, y);
  }

  public void convertStdMouseMoveInMickeys(SWIGTYPE_p_float dx, SWIGTYPE_p_float dy) {
    nelmiscJNI.IMouseDevice_convertStdMouseMoveInMickeys(swigCPtr, this, SWIGTYPE_p_float.getCPtr(dx), SWIGTYPE_p_float.getCPtr(dy));
  }

  public final static class TAxisMode {
    public final static TAxisMode Raw = new TAxisMode("Raw");
    public final static TAxisMode Clamped = new TAxisMode("Clamped");
    public final static TAxisMode AxisModeLast = new TAxisMode("AxisModeLast");

    public final int swigValue() {
      return swigValue;
    }

    public String toString() {
      return swigName;
    }

    public static TAxisMode swigToEnum(int swigValue) {
      if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue)
        return swigValues[swigValue];
      for (int i = 0; i < swigValues.length; i++)
        if (swigValues[i].swigValue == swigValue)
          return swigValues[i];
      throw new IllegalArgumentException("No enum " + TAxisMode.class + " with value " + swigValue);
    }

    private TAxisMode(String swigName) {
      this.swigName = swigName;
      this.swigValue = swigNext++;
    }

    private TAxisMode(String swigName, int swigValue) {
      this.swigName = swigName;
      this.swigValue = swigValue;
      swigNext = swigValue+1;
    }

    private TAxisMode(String swigName, TAxisMode swigEnum) {
      this.swigName = swigName;
      this.swigValue = swigEnum.swigValue;
      swigNext = this.swigValue+1;
    }

    private static TAxisMode[] swigValues = { Raw, Clamped, AxisModeLast };
    private static int swigNext = 0;
    private final int swigValue;
    private final String swigName;
  }

  public final static class TAxis {
    public final static TAxis XAxis = new TAxis("XAxis", nelmiscJNI.IMouseDevice_XAxis_get());
    public final static TAxis YAxis = new TAxis("YAxis", nelmiscJNI.IMouseDevice_YAxis_get());
    public final static TAxis AxisLast = new TAxis("AxisLast");

    public final int swigValue() {
      return swigValue;
    }

    public String toString() {
      return swigName;
    }

    public static TAxis swigToEnum(int swigValue) {
      if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue)
        return swigValues[swigValue];
      for (int i = 0; i < swigValues.length; i++)
        if (swigValues[i].swigValue == swigValue)
          return swigValues[i];
      throw new IllegalArgumentException("No enum " + TAxis.class + " with value " + swigValue);
    }

    private TAxis(String swigName) {
      this.swigName = swigName;
      this.swigValue = swigNext++;
    }

    private TAxis(String swigName, int swigValue) {
      this.swigName = swigName;
      this.swigValue = swigValue;
      swigNext = swigValue+1;
    }

    private TAxis(String swigName, TAxis swigEnum) {
      this.swigName = swigName;
      this.swigValue = swigEnum.swigValue;
      swigNext = this.swigValue+1;
    }

    private static TAxis[] swigValues = { XAxis, YAxis, AxisLast };
    private static int swigNext = 0;
    private final int swigValue;
    private final String swigName;
  }

  public final static class TMessageMode {
    public final static TMessageMode NormalMode = new TMessageMode("NormalMode");
    public final static TMessageMode RawMode = new TMessageMode("RawMode");
    public final static TMessageMode MessageModeLast = new TMessageMode("MessageModeLast");

    public final int swigValue() {
      return swigValue;
    }

    public String toString() {
      return swigName;
    }

    public static TMessageMode swigToEnum(int swigValue) {
      if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue)
        return swigValues[swigValue];
      for (int i = 0; i < swigValues.length; i++)
        if (swigValues[i].swigValue == swigValue)
          return swigValues[i];
      throw new IllegalArgumentException("No enum " + TMessageMode.class + " with value " + swigValue);
    }

    private TMessageMode(String swigName) {
      this.swigName = swigName;
      this.swigValue = swigNext++;
    }

    private TMessageMode(String swigName, int swigValue) {
      this.swigName = swigName;
      this.swigValue = swigValue;
      swigNext = swigValue+1;
    }

    private TMessageMode(String swigName, TMessageMode swigEnum) {
      this.swigName = swigName;
      this.swigValue = swigEnum.swigValue;
      swigNext = this.swigValue+1;
    }

    private static TMessageMode[] swigValues = { NormalMode, RawMode, MessageModeLast };
    private static int swigNext = 0;
    private final int swigValue;
    private final String swigName;
  }

}
